﻿<?php
$num = $mysql->query("SELECT * FROM ".$tb_prefix."ads");
$total = $mysql->num_rows($num);
if($total) {
	$m_per_page = 30;
	if (!$pg) $pg = 1;
	$sql = "SELECT * FROM ".$tb_prefix."ads ORDER BY ads_id DESC LIMIT ".(($pg-1)*$m_per_page).",".$m_per_page;
	$query = $mysql->query($sql);
		while($row = $mysql->fetch_array($query)) {
			$ads_ID		=	$row['ads_id'];
			$ads_WEB	=	$row['ads_web'];
			$ads_URL	=	$row['ads_url'];
			$ads_LOGO	=	$row['ads_img'];
			$ads_HTML	.=	"<tr align=center class=fr><td><a href='?act=ads&del_id=".$ads_ID."'>DEL</a> - <a href='?act=ads&mode=edit&id=".$ads_ID."'><b>".$ads_WEB."</b></a></td><td class=fr_2><a href=\"".$ads_URL."\" target=_blank><b>".$ads_URL."</b></a></td><td class=fr><img src=\"".$ads_LOGO."\" width=160 height=80></td></tr>";
		}
}
if(!$total) {
	$user_HTML = "<tr><td></td><td align=center>Chua có Ads</td></tr>";
}
include("templates/list_ads.html");
?>